//两个数组的交集
function repertNum(num1,nums){
    var result=[...new Set(num1.filter(item=>nums.includes(item)))]
    return result
}
function repertNum1(num1,nums){//没有去重
    var map=new Map()
    var result=[]
    num1.forEach(item=>{
        map[item]=true
    })
    nums.forEach(item=>{
        if(map[item]){
            result.push(item)
        }
    })
    return result
}

//多个数组的交集
const mixed = (...arrs) => {
    return [...new Set(arrs.reduce((sum,arr) => {
        return arr.filter(i => sum.includes(i));
    }))]
}
var nums1 = [4,9,5], nums2 = [9,4,9,8,4],num3=[2,4]
console.log(mixed(nums1,nums2,num3))
